//
//  ViewController.m
//  IOSUI思路
//
//  Created by 崔博 on 2018/9/26.
//  Copyright © 2018年 崔博. All rights reserved.
//

#import "ViewController.h"
#import "ProgressView.h"
#import "ProgressPlay.h"
@interface ViewController ()<ProgressPlayDelegate>
@property (weak, nonatomic) IBOutlet ProgressView *progressView;
@property (nonatomic, strong) ProgressPlay *play;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.play = [[ProgressPlay alloc] init];
    self.play.delegate = self;
    UIColor *tintColor = [UIColor greenColor];
    self.progressView.tinColor = tintColor;
    self.progressView.trackColor = [UIColor colorWithWhite:0.5 alpha:1.0];
}

- (void) player:(ProgressPlay *)play didReachPosition:(float)position
{
    self.progressView.proress = position;
}
- (void) playDidStip:(ProgressPlay *)player
{
    self.progressView.proress = 0.0;
}
- (IBAction)click:(UIButton *)sender {
    if (sender.selected) {
        [self.play pause];
    }else
    {
        [self.play play];
    }
    sender.selected = !sender.selected;
}
@end
